<?php
class Person extends AppModel {
    var $name = 'Person';
    var $primaryKey = 'person_id';
    var $displayField = 'surname';

    var $hasOne = array('User');

    var $belongsTo = array(
        'Address',
        'IdCardType' => array(
            'className' => 'LookupValue',
            'foreignKey' => 'id_card_type',
            'conditions' => array('IdCardType.lookup_type' => 'ID_CARD_TYPE'),
            'order' => 'IdCardType.meaning'
        )
    );

    var $hasMany = array(
        'DoormanBuilding' => array(
                'className' => 'Building',
                'foreignKey' => 'doorman_id',
                'dependent' => false
        ),
        'PropertyOwner' => array(
                'className' => 'Property',
                'foreignKey' => 'owner_id',
                'dependent' => false
        ),
        'PropertyOwnerRepresentative' => array(
                'className' => 'Property',
                'foreignKey' => 'owner_representative_id',
                'dependent' => false
        ),
        'PropertyTenant' => array(
                'className' => 'Property',
                'foreignKey' => 'tenant_id',
                'dependent' => false
        ),
        'PropertyTenantRepresentative' => array(
                'className' => 'Property',
                'foreignKey' => 'tenant_representative_id',
                'dependent' => false
        ),
        'RefinancingPlan',
        'CouncilMember'
    );
}
?>
